using System;
using System.Collections.Generic;
using System.Text;
using JSC.Core.Attributes;
using NHibernate;
#if NHibernateLINQ
using System.Linq;
#endif

namespace JSC.Core
{
    [ConcreteType("JSC.Data.NHibernate.CommonDao<>, JSC.Data")]
	public interface IDao<T>
	{
#if NHibernateLINQ
        IQueryable<T> Linq();
#endif
        T GetById(int id, bool shouldLock);
        T GetById(int id, bool shouldLock, bool createEmpty);
		List<T> GetAll();
		List<T> GetByExample(T exampleInstance, params string[] propertiesToExclude);
        T GetUniqueByExample(T exampleInstance, params string[] propertiesToExclude);
        List<T> GetByQuery(string query, Dictionary<string, object> parameters);
        T GetUniqueByQuery(string query, Dictionary<string, object> parameters);
        List<T> GetBySQLQuery(string query, Dictionary<string, object> parameters);
        T GetUniqueBySQLQuery(string query, Dictionary<string, object> parameters);
        IQuery GetQuery(string query);
        T Save(T entity);
		T SaveOrUpdate(T entity);
		void Delete(T entity);
	}
}
